;(function(){
  'use strict';
  angular.module('controllers.oldOMDisplay.upayQM')
  .controller('tradeStatRepFormCtrl', tradeStatRepFormCtrl);

  function tradeStatRepFormCtrl($scope,COREDATA,TradeStatRepFormSelecotor,TradeStatRepFormQueryParam,TradeStatRepFormViewObj){
    $scope.selector = TradeStatRepFormSelecotor.selector;
    $scope.tradeStatRepForm = TradeStatRepFormQueryParam.initParam();
    $scope.date = TradeStatRepFormQueryParam.initDate();
    $scope.flag = TradeStatRepFormQueryParam.initFlag();
    $scope.viewObj = TradeStatRepFormViewObj.initViewObj();
    $scope.tradeStatRepFormQuery = TradeStatRepFormQueryParam.tradeStatRepFormQueryFn;
    $scope.exportUrl = COREDATA.FORMPREFIX+'OMdisplay/upayQM/businessForm/tradeStatistics/export';
    $scope.resetParam = function(){
      $scope.tradeStatRepForm = TradeStatRepFormQueryParam.initParam();
      $scope.date = TradeStatRepFormQueryParam.initDate();
      $scope.flag = TradeStatRepFormQueryParam.initFlag();
      $scope.viewObj = TradeStatRepFormViewObj.initViewObj();
    };

    $scope.$watch('tradeStatRepForm.timeType',function(n,o){
      if(n === o) return;
      $scope.date = TradeStatRepFormQueryParam.initDate();
    },true);
 
  }

  tradeStatRepFormCtrl.$inject = ['$scope','COREDATA','TradeStatRepFormSelecotor','TradeStatRepFormQueryParam','TradeStatRepFormViewObj'];

})();